package com.lin.fund;

import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.time.StopWatch;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.MarkerManager;
import org.apache.logging.log4j.message.MessageFormatMessageFactory;


/**
 * Hello world!
 *
 */
public class App {
	private static final Logger logger = LogManager.getLogger(App.class);
	public static void main(String[] args) throws InterruptedException {
		int sleepTime = 500;
		logger.trace("trace");
		Thread.sleep(sleepTime);
		logger.debug("debug");
		Thread.sleep(sleepTime);
		logger.info("info{}","-------");
		Thread.sleep(sleepTime);
		logger.warn("warn");
		Thread.sleep(sleepTime);
		logger.error("error");
		logger.fatal(new MessageFormatMessageFactory().newMessage("BAD MSG{0}", new NullPointerException()));
		logger.debug(MarkerManager.getMarker("FLOW"),"这是什么");
		logger.debug(MarkerManager.getMarker("EXCEPTION"),"这是什么");
		for(int i=0;i<100000;i++){
			StopWatch watch = new StopWatch();
			watch.start();
			logger.debug(RandomStringUtils.randomAlphabetic(1024));
			watch.stop();
			logger.debug(i+":"+watch.toString());
//			Thread.sleep(10);//记得修改log4j2.xml日志级别看下效果
		}
	}
}
